package com.anjbo.service.circle.estatedeal.impl;

import com.anjbo.bean.estatedeal.*;
import com.anjbo.dao.app.circle.estatedeal.DealDataMapper;
import com.anjbo.service.circle.estatedeal.DealDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * Created by Administrator on 2017/3/13.
 */
@Service("dealDataService")
public class DealDataServiceImpl implements DealDataService {


    @Autowired
    protected DealDataMapper dealDataMapper;

    @Override
    public List<SZDealDto> szOneHandDataAndAvgPrice(String startDate, String endDate) {
        return dealDataMapper.szOneHandDataAndAvgPrice(startDate,endDate);
    }

    @Override
    public List<SZDealDto> szSecondHandData(String startDate, String endDate) {
        return dealDataMapper.szSecondHandData(startDate,endDate);
    }

    @Override
    public List<SZDealDto> szSecondHandDetail(String startDate, String endDate) {
        return dealDataMapper.szSecondHandDetail(startDate,endDate);
    }

    @Override
    public List<DGDealDto> dgDealData(Integer type) {
        return dealDataMapper.dgDealData(type);
    }

    @Override
    public List<DGDealDto> dgDealDetail(Integer type) {
        return dealDataMapper.dgDealDetail(type);
    }

    @Override
    public List<GZDealDto> gzDealData(int type, String startDate, String endDate) {
        return dealDataMapper.gzDealData(type,startDate ,endDate );
    }

    @Override
    public List<XMDealDto> xmDealData() {
        return dealDataMapper.xmDealData();
    }

    @Override
    public List<HZDealDto> hzDealData(Integer type, String startDate, String endDate) {
        return dealDataMapper.hzDealData(type,startDate,endDate);
    }

    @Override
    public Date selectSZMaxDate() {
        return dealDataMapper.selectSZMaxDate();
    }

    @Override
    public SZDealDto selectScndTotalNumByMonth(String month) {
        SZDealDto dto = dealDataMapper.selectScndTotalNumByMonth(month);
        if(dto==null){
            dto=dealDataMapper.selectScndTotalNumByMonthExt(month);
        }
        return dto;
    }

    @Override
    public List<SZDealDto> selectScndMediumByMonth(String month) {
        return dealDataMapper.selectScndMediumByMonth(month);
    }

    @Override
    public SZDealDto selectOneTotalNumByMonth(String month) {
        SZDealDto dto = dealDataMapper.selectOneTotalNumByMonth(month);
        if(dto==null){
            dto = dealDataMapper.selectOneTotalNumByMonthExt(month);
        }
        return dto;
    }

    @Override
    public List<SZDealDto> selectOneDetailByMonth(String month) {
        return dealDataMapper.selectOneDetailByMonth(month);
    }

    @Override
    public SZDealDto selectScndTotalNumByDay(String day) {
        return dealDataMapper.selectScndTotalNumByDay(day);
    }

    @Override
    public List<SZDealDto> selectScndMediumByDay(String day) {
        return dealDataMapper.selectScndMediumByDay(day);
    }

    @Override
    public SZDealDto selectOneTotalNumByDay(String day) {
        return dealDataMapper.selectOneTotalNumByDay(day);
    }

    @Override
    public List<SZDealDto> selectOneDetailByDay(String day) {
        return dealDataMapper.selectOneDetailByDay(day);
    }

    @Override
    public DGDealDto selectDGDealDataByMonthType(String month, int type) {
        return dealDataMapper.selectDGDealDataByMonthType(month,type);
    }

    @Override
    public List<DGDealDto> selectDGDealDetailByMonthType(String month, int type) {
        return dealDataMapper.selectDGDealDetailByMonthType(month,type);
    }

    @Override
    public DGDealDto selectDGDealDataByDayType(String day, int type) {
        return dealDataMapper.selectDGDealDataByDayType(day,type);
    }

    @Override
    public List<DGDealDto> selectDGDealDetailByDayType(String day, int type) {
        return dealDataMapper.selectDGDealDetailByDayType(day,type);
    }

    @Override
    public GZDealDto selectGZDealDataByMonthType(String month, int type) {
        return dealDataMapper.selectGZDealDataByMonthType(month,type);
    }

    @Override
    public List<GZDealDto> selectGZDealDetailByMonthType(String month, int type) {
        return dealDataMapper.selectGZDealDetailByMonthType(month,type);
    }

    @Override
    public GZDealDto selectGZDealDataByDayType(String day, int type) {
        return dealDataMapper.selectGZDealDataByDayType(day,type);
    }

    @Override
    public List<GZDealDto> selectGZDealDetailByDayType(String day, int type) {
        return dealDataMapper.selectGZDealDetailByDayType(day,type);
    }

    @Override
    public HZDealDto selectHZDealDataByMonthType(String month, int type) {
        return dealDataMapper.selectHZDealDataByMonthType(month,type);
    }

    @Override
    public HZDealDto selectHZDealDataByDayType(String day, int type) {
        return dealDataMapper.selectHZDealDataByDayType(day,type);
    }

    @Override
    public XMDealDto selectXMDealDataByMonthType(String month, int type) {
        return dealDataMapper.selectXMDealDataByMonthType(month,type);
    }

    @Override
    public XMDealDto selectXMDealDataByDayType(String day, int type) {
        return dealDataMapper.selectXMDealDataByDayType(day,type);
    }

    @Override
    public List<DGDealDto> selectDGMonthData() {
        return dealDataMapper.selectDGMonthData();
    }

    @Override
    public List<DGDealDto> selectDGMonthDetail() {
        return dealDataMapper.selectDGMonthDetail();
    }

    @Override
    public List<DGDealDto> selectDGDayData() {
        return dealDataMapper.selectDGDayData();
    }

    @Override
    public List<DGDealDto> selectDGDayDetail() {
        return dealDataMapper.selectDGDayDetail();
    }

    @Override
    public List<GZDealDto> selectGZMonthData() {
        return dealDataMapper.selectGZMonthData();
    }

    @Override
    public List<GZDealDto> selectGZMonthDetail() {
        return dealDataMapper.selectGZMonthDetail();
    }

    @Override
    public List<GZDealDto> selectGZDayData() {
        return dealDataMapper.selectGZDayData();
    }

    @Override
    public List<GZDealDto> selectGZDayDetail() {
        return dealDataMapper.selectGZDayDetail();
    }

    @Override
    public List<HZDealDto> selectHZMonthData() {
        return dealDataMapper.selectHZMonthData();
    }

    @Override
    public List<HZDealDto> selectHZDayData() {
        return dealDataMapper.selectHZDayData();
    }

    @Override
    public List<XMDealDto> selectXMMonthData() {
        return dealDataMapper.selectXMMonthData();
    }

    @Override
    public List<XMDealDto> selectXMDayData() {
        return dealDataMapper.selectXMDayData();
    }

    @Override
    public List<SZDealDto> selectSZMonthScndData() {
        List<SZDealDto> data = dealDataMapper.selectSZMonthScndData();
        if(data!=null&&data.size()<12){
            String month = data.get(data.size() - 1).getMonth();
            List<SZDealDto> r=dealDataMapper.selectSZDataExt(month,2);
            for(SZDealDto dto:r){
                if(data!=null&&data.size()<12){
                    data.add(dto);
                }
            }
        }
        return data;
    }

    @Override
    public List<SZDealDto> selectSZMonthScndDetail() {
        return dealDataMapper.selectSZMonthScndDetail();
    }

    @Override
    public List<SZDealDto> selectSZDayScndData() {
        return dealDataMapper.selectSZDayScndData();
    }

    @Override
    public List<SZDealDto> selectSZDayScndDetail() {
        return dealDataMapper.selectSZDayScndDetail();
    }

    @Override
    public List<SZDealDto> selectSZMonthOneData() {
        List<SZDealDto> data = dealDataMapper.selectSZMonthOneData();
        if(data!=null&&data.size()<12){
            String month = data.get(data.size() - 1).getMonth();
            List<SZDealDto> r=dealDataMapper.selectSZDataExt(month,1);
            for(SZDealDto dto:r){
                if(data!=null&&data.size()<12){
                    data.add(dto);
                }
            }
        }
        return data;
    }

    @Override
    public List<SZDealDto> selectSZMonthOneDetail() {
        return dealDataMapper.selectSZMonthOneDetail();
    }

    @Override
    public List<SZDealDto> selectSZDayOneData() {
        return dealDataMapper.selectSZDayOneData();
    }

    @Override
    public List<SZDealDto> selectSZDayOneDetail() {
        return dealDataMapper.selectSZDayOneDetail();
    }
}
